<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
	content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
<meta content="yes" name="apple-mobile-web-app-capable">
<meta content="black" name="apple-mobile-web-app-status-bar-style">
<title>工作安排</title>
<link href="/Public/Home/css/weui.min.css" rel="stylesheet">
<link rel="stylesheet" href="/Public/Home/Saleman/stylesheets/index.css?s=444442343">
 <link rel="stylesheet" href="/Public/Home/SaleManager/stylesheets/salemanagerindex.css?s=444442343">
<link rel="stylesheet" href="/Public/Home/Saleman/stylesheets/dropload.css">
<link rel="stylesheet" href="/Public/Home/Saleman/stylesheets/webuploader.css"><!-- 上传插件样式 -->
 <script src="/Public/Home/SaleManager/js/jquery.min.js"></script>
</head>
<style>
.webuploader-pick {
    position: relative!important;
     display: block!important;
    cursor: pointer;
    background: #fff!important;
    padding: 0px 0px;
    color: #0c0c0c!important;
    text-align: center;
    border-radius: 3px;
    /* overflow: hidden; */
}
#fileList {
	/* height: 60px!important; */
    /* margin-bottom: 74px; */}
#fileList .file-item{
	width: 70px!important;
    height: 70px!important;
    position: relative!important;
    float: left!important;
    padding-left: 10px;
    margin-bottom: 30px;
    
}
#fileList .file-item img {
	width:70px!important;
	height:70px!important;
}
.add-content {
    width: 100%;
    background: #fff;
    padding-bottom: 10px;
    position: relative;
    height: 50px;
    overflow: hidden;
   /*  z-index:10000; */
   margin-top: 20px;
}
.info{
	display:none;
	height:46px;
}
.confirm_buttons{
	padding:0px 5px 0 5px;border-radius:0px!important;
}
.updata-dialog-ok .weui-btn_primary{
	border-radius: 5px!important;
}
/* .add-content {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    position: absolute;
    z-index: 500;
    bottom: 0;
    width: 100%;
    background-color: #f7f7fa;
} */
</style>
<body style="background: #ffffff;">
	<div class="work_argument">
		<header class="all_header">
			<a class="h_back h_back_1" href="javascript:void(0)" data-role-id='<?php echo ($myself["role_id"]); ?>'><img
				src="/Public/Home/Saleman/images/back_icon.png" alt=""></a> <span
				class="h_title">工作安排</span> <a class="h_add btn_send"
				href="javascript:;" pos_title="确定发送给上级">发送</a>
		</header>
		<div class="weui-tab">
			<div class="weui-navbar">
				<div class="weui-navbar__item weui-bar__item_on">今日完成工作</div>
				<div class="weui-navbar__item">明日计划</div>
				<div class="weui-navbar__item">记录</div>
			</div>
			<div class="weui-tab__panel">
				<!--今日完成工作-->
				<div class="weui-list cur_cont today_box " style="display: block;">
					<?php if(!empty($tripTodayList)): ?><div class="weui-cells weui-cells_checkbox work_lists">
						<?php if(is_array($tripTodayList)): $k = 0; $__LIST__ = $tripTodayList;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$tripTodayVo): $mod = ($k % 2 );++$k;?><label
							class="weui-cell weui-check__label " id='totay_pop_<?php echo ($k); ?>'
							attr-id='<?php echo ($tripTodayVo["id"]); ?>' for="s11">
							<div class="weui-cell__bd" style="flex: 2">
								<p class="cur_intro"><?php echo (msubstr($tripTodayVo['content'],0,10,'utf-8',true)); ?></p>
								<input type="hidden" value="<?php echo ($tripTodayVo['content']); ?>" />
							</div>
							<div class="weui-cell__bd cur_date">
								<p><?php echo ($tripTodayVo['work_day']); ?></p>
							</div>

						</label><?php endforeach; endif; else: echo "" ;endif; ?>
					</div>
						
					<?php else: ?>
					<div class="weui-cells weui-cells_checkbox work_lists"></div>
					<!-- <div class="no_work today_no_work" style="display: block;">
						
						<div class="no_img"></div>
						<div class="no_tips"></div>
					</div> --><?php endif; ?>
			<!-- 新增 -->
                  <div class="input-txt">
                    <textarea id="w-txt" class="w-txt weui-input cur_ipt" resize="none" value="" placeholder="请输入内容"></textarea>
                  </div>
                  <!-- 照片上传 -->
                  <h6 class="upload-pic-wrap">
                      <span class="up-des1">照片上传</span>
                        <div id="filePicker" class="col-md-2 col-md-offset-2" style="position: relative">
                  <span class="upload-logo iconfont">
                         &#xe688;
                       </span>
                        </div>
                     <!--   <input id="js_input_file_pic" onchange=preview(this) name="uploadFile" class="fileUpload" type="file"> -->
                  </h6>
                  <div id="fileList" class="uploader-list col-md-10" style="padding-top:10px ">
                        </div>
                  <!--  <h6 class="upload-pic-wrap">
                      <span class="up-des"></span>
                      <span class="upload-logo iconfont">
                         &#xe688;
                       </span>
                       <input id="js_input_file_pic" name="uploadFile" class="fileUpload" type="file">
                  </h6> -->
                  <!-- 照片上传 -->
                  <!-- 提交按钮 -->
                  <div class="cur_btn_w add-content">
                    <a href="javascript:;" class="weui-btn weui-btn_primary">添加</a>
                  </div>
                  <!-- 提交按钮 -->
                  <!-- 新增 -->
					
				</div>
				
				<!--明日安排-->
				<div class="weui-list next_cont tomorrow_box">
					<?php if(!empty($tripTomorrowList)): ?><div class="weui-cells weui-cells_checkbox next_w_lists">
						<?php if(is_array($tripTomorrowList)): $k = 0; $__LIST__ = $tripTomorrowList;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$tripTomorrowVo): $mod = ($k % 2 );++$k;?><label class="weui-cell weui-check__label " id='tomorrow_pop_<?php echo ($k); ?>'
							attr-id='<?php echo ($tripTomorrowVo["id"]); ?>' for="s1111">
							<div class="weui-cell__bd" style="flex: 2">
								<p class="next_intro"><?php echo (msubstr($tripTomorrowVo['content'],0,10,'utf-8',true)); ?></p>
								<input type="hidden" value="<?php echo ($tripTomorrowVo['content']); ?>" />
							</div>
							<div class="weui-cell__bd cur_date">
								<p><?php echo ($tripTomorrowVo['work_day']); ?></p>
							</div>
						</label><?php endforeach; endif; else: echo "" ;endif; ?>
					</div>
					<?php else: ?>
					<div class="no_work tomorrow_no_work" style="display: block;">
						<div class="no_img"></div>
						<div class="no_tips"></div>
					</div><?php endif; ?>
				</div>
				<!--已发送的今日完成工作记录-->
				<div class="weui-list pre_cont sendlog">
					<div class="weui-cells weui-cells_checkbox pre_w_lists"></div>
					<div class="pre_sel_w"></div>
				</div>
			</div>
		</div>
	</div>
					<div class="next_sel_w " style="display:none">
						<div class="next_add_w add-demo">
							<div class="weui-cell">
								<div class="weui-cell__bd">
									<input class="weui-input next_ipt" type="text"
										placeholder="请输入文本">
								</div>
							</div>
							<div class="next_btn_w">
								<a href="javascript:;" class="weui-btn weui-btn_primary">添加</a>
							</div>
						</div>
					</div>

				<!-- 	<div class="cur_sel_w">
						<div class="cur_add_w add-demo">
							<div class="weui-cell">
								<div class="weui-cell__bd">
									<input class="weui-input cur_ipt" type="text"
										placeholder="请输入文本">
								</div>
							</div>
							<div class="cur_btn_w">
								<a href="javascript:;" class="weui-btn weui-btn_primary">添加</a>
							</div>
						</div>
					</div> -->

	<div class="js_dialog" id="delmessage" style="display: none;">
		<div class="weui-mask"></div>
		<div class="weui-dialog">
			<div class="weui-dialog__bd sure-info"></div>
			<div class="weui-dialog__ft">
				<a href="javascript:;"
					class="weui-dialog__btn weui-dialog__btn_primary work_buttons">取消</a>
				<a href="javascript:;"
					class="weui-dialog__btn weui-dialog__btn_primary del_buttons">确定</a>
			</div>
		</div>
	</div>
	<div class="js_dialog" id="workplay" style="display: none;">
		<div class="weui-mask"></div>
		<div class="weui-dialog">
			<div class="weui-dialog__bd sure-info"></div>
			<div class="weui-dialog__ft">
				<a href="javascript:;"
					class="weui-dialog__btn weui-dialog__btn_primary work_buttons">取消</a>
				<a href="javascript:;"
					class="weui-dialog__btn weui-dialog__btn_primary del_confirm_buttons">删除</a>
				<a href="javascript:;"
					class="weui-dialog__btn weui-dialog__btn_primary edit_buttons">编辑</a>
			</div>
		</div>
	</div>
	<div class="js_dialog" id="content-editor" style="display: none;">
		<div class="weui-mask"></div>
		<div class="weui-dialog">
			<div class="weui-dialog__bd sure-info">
				<!-- <div class="weui-cell">
              <div class="weui-cell__bd">
                  <input class="weui-input next_ipt" type="text" id='text-editor' placeholder="请输入文本">
              </div>
             </div></div> -->
				<div class="weui-cells__title" style="font-size: 16px">编辑</div>
				<div class="weui-cells weui-cells_form">
					<div class="weui-cell">
						<div class="weui-cell__bd">
							<textarea class="weui-textarea" placeholder="请输入文本"
								id='text-editor' rows="3"></textarea>
							<div class="weui-textarea-counter">
								<span>0</span>/200
							</div>
						</div>
					</div>
				</div>
				<div class="weui-dialog__ft">
				<a href="javascript:;"
					class="weui-dialog__btn weui-dialog__btn_primary work_buttons">取消</a>
					<a href="javascript:;"
						class="weui-dialog__btn weui-dialog__btn_primary confirm_buttons">确定</a>
				</div>
			</div>
		</div>
	</div>
	<!-- 编辑弹层 -->    
      <div class="updata-dialog-ok" id="updata-dialog">
          <div class="ui-dialog-content">
                   <span class="close-btn iconfont">&#xe662;</span>
                  <!-- 新增 -->
                  <div class="input-txt">
                    <textarea id="w-txt2" class="w-txt weui-input cur_ipt" resize="none" value="" placeholder="请输入内容">1、与客户沟通医药通增加功能的细节2、完成医药通增加功能的原型设计3、其他项目事宜</textarea>
                  </div>
                  <!-- 照片上传 -->
                  <h6 class="upload-pic-wrap">
                      <span class="up-des">照片上传</span>
                 <!--      <span class="upload-logo iconfont" onclick='triggerFile()'>
                         &#xe688;
                       </span>
                       <input id="js_input_file_pic_edit "  name="uploadFile_edit" class="fileUpload" type="file"> -->
                  </h6>
                   <h6 class="upload-pic-wrap input_edit">
                      <span class="up-des_edit"></span>
                      <span class="upload-logo iconfont">
                         &#xe688;
                       </span>
                       <input id="js_input_file_pic" onchange=preview(this) name="uploadFile" class="fileUpload edit" type="file"> 
                  </h6>
                  <!-- 照片上传 -->
                  <!-- 提交按钮 -->
                  <div class="cur_btn_w1 edit-content confirm_buttons">
                    <a href="javascript:;" class="weui-btn weui-btn_primary">修改</a>
                  </div>
                  <!-- 提交按钮 -->
          </div>        
      </div>
 <!-- 编辑弹层 --> 
	<!-- <script src="/Public/Home/Saleman/js/zepto.min.js"></script> -->


	 <div class="js_dialog" id="iosDialog1" style="display: none;">
    <div class="weui-mask"></div>
    <div class="weui-dialog">
        <div class="weui-dialog__hd"><strong class="weui-dialog__title">提示</strong></div>
        <div class="weui-dialog__bd confir_content"></div>
        <div class="weui-dialog__ft">
            <a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_default cancel-btn">取消</a>
            <a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_primary ok-btn">确定</a>
        </div>
    </div>
</div>


 <div class="js_dialog" id="iosDialog_2" style="display: none;">
    <div class="weui-mask"></div>
    <div class="weui-dialog">
        <div class="weui-dialog__hd"><strong class="weui-dialog__title">提示</strong></div>
        <div class="weui-dialog__bd confir_content"></div>
        <div class="weui-dialog__ft">
            <a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_default cancels-btn">取消</a>
            <a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_primary oks-btn">确定</a>
        </div>
    </div>
</div> 

<div class="js_dialog" id="iosDialog2" style="display: none;">
    <div class="weui-mask"></div>
    <div class="weui-dialog">
        <div class="weui-dialog__bd sure-info"></div>
        <div class="weui-dialog__ft">
            <a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_primary sure-btn" pos_url="location.href">知道了</a>
        </div>
    </div>
</div>

<div class="js_dialog" id="signiosDialog2" style="display: none;">
    <div class="weui-mask"></div>
    <div class="weui-dialog">
        <div class="weui-dialog__bd confir_content"></div>
        <div class="weui-dialog__ft">
        		<a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_default signcancels-btn">知道了</a>
            <a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_primary sure-btn" pos_url="location.href">重试</a>
        </div>
    </div>
</div>

<div class="js_dialog" id="iosDialogsign" style="display: none;">
    <div class="weui-mask"></div>
    <div class="weui-dialog">
        <div class="weui-dialog__bd sure-info"></div>
        <div class="weui-dialog__ft">
            <a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_primary signsure-btn" pos_url="location.href">知道了</a>
        </div>
    </div>
</div>
<script>
    $('.cancel-btn').on('click', function () {
        $('#iosDialog1').hide(200);
    });
    $('.sure-btn').on('click', function () {
        $('#iosDialog2').hide(200);

        var pos_url = $(this).attr('pos_url');

        if (pos_url != "") {
            location.href = location.href;
        }


    });
</script>
		<div id="loadingToast" style="opacity: 0; display: none;">
        <div class="weui-mask_transparent"></div>
        <div class="weui-toast">
            <i class="weui-loading weui-icon_toast"></i>
            <p class="weui-toast__content">正在处理中...</p>
        </div>
    </div>
   
	<script src="/Public/Home/SaleManager/js/androidback.js"></script>
	<script src="/Public/Home/Saleman/js/index.js"></script>
	<script src="/Public/Home/Saleman/js/dropload.min.js"></script>
	 <script src="/Public/Home/Saleman/js/webuploader/webuploader.js"></script>
<script type="text/javascript">
var uploaderImg;
  $(function(){
       // 关闭弹窗
         $("#updata-dialog .close-btn").click(function(){
            $("#updata-dialog").css("display","none");
            $('.up-des').css('display','block');
			   $('.input_edit').css('display','block');
         })
        // $("#updata-dialog").css("display","-webkit-box")
         // 出现弹窗
         // $("#编辑标签").click(function(){
         //   $("#updata-dialog").css("display","-webkit-box")
         // })
  }) 
 </script>
	<script>
	var images  = new Array();
  //今日完成工作添加
    $(".cur_btn_w").on("click", function () {
        var content = $(".cur_ipt").val();
        if (content.length == 0) {
            $('#iosDialog2').find('.sure-info').html("请输入填写内容");
            $('#iosDialog2').show(200);
            return;
        }
        $.ajax({
            url: "/Home/Saleman/Saleman/workArgument/op/add",
            type: 'post',
            data: {type: 1, content: content,images,images},
            cache: false,
            dataType: "json",
            success: function (result) {
                if (result['code'] != 1) {
                		 $('#iosDialog2').find('.sure-info').html(result['msg']);
                     $('#iosDialog2').show(200);
                   /*  alert(result['msg']); */
                    return;
                }
                images.length = 0;
                $('.up-des').empty();
                $('.up-des_edit').empty();
                var data = result['data'];
               
                var str = '';
                str += '<label class="weui-cell weui-check__label" for="s11" attr-id="'+data['flag']+'" id="totay_pop_'+data['flag']+'">';
                str += '<div class="weui-cell__bd" style = "flex: 2">';
                str += '<p class = "cur_intro">' + data['content'].slice(0,10) + '......</p>';
                str+='<input type="hidden" value='+data['content']+'>';
                str += '</div>';
                str += '<div class="weui-cell__bd cur_date">';
                str += '<p>' + data['work_day'] + '</p>';
                str += '</div>';
                str += '</label>';

                if ($('.today_no_work').length > 0) {
                    $('.today_no_work').remove();
                }
                if ($('.work_lists').length <= 0) {
                    var box = '<div class="weui-cells weui-cells_checkbox work_lists"></div>';
                    $('.today_box').append(box);
                }

                $(".work_lists").append(str);
                $(".cur_ipt").val('');
                uploaderImg.reset();
                $('#fileList').empty();

            }
        });
    });
  		//发送按钮触发事件
        $('.btn_send').on('click', function () {
            var title = $(this).attr('pos_title');
            $('.confir_content').html(title);
            $("#iosDialog1").show(200);
        });

  		//确定发送按钮触发事件
        $('.ok-btn').on('click', function () {
            //发送给上级
            $.ajax({
                url: "/Home/Saleman/Saleman/workArgument/op/send",
                type: 'post',
                dataType: "json",
                success: function (result) {
                    $("#iosDialog1").hide(200);
                    $('#iosDialog2').find('.sure-info').html(result['msg']);
                    $('#iosDialog2').show(200);
                }
            });
        });


        //发送记录

        var page = 0;
        var itemIndex = 0;
        // dropload
        var dropload = $('.sendlog').dropload({
        	scrollArea : window,
            loadDownFn: function (me) {
                // 加载菜单一的数据
                if (itemIndex == '2') {
                	 me.lock();
                	 page++;
                	 
                    $.ajax({
                        type: 'post',
                        url: '/Home/Saleman/Saleman/workArgument/op/sendlog',
                        data: {page: page},
                        dataType: 'json',
                        success: function (result) {
                            page++;
                            var data = result['data'];
			 	
                            if (data == null) {
                                // 锁定
                                me.lock();
                                // 无数据
                                me.noData();
                                me.resetload();
                                return;
                            }

                            var str = '';
                            for (var i = 0; i < data.length; i++) {
                                str += '<label class="weui-cell weui-check__label" for="s1211">';
                                str += '<div class="weui-cell__bd" style = "flex: 2">';
                                str += '<p class = "pre_intro">' + data[i]['content'].slice(0,10) + '.....</p>';
                                str+='<input type="hidden" value='+data[i]['content']+'>';
                                str += '</div>';
                                str += '<div class="weui-cell__bd cur_date">';
                                str += '<p>' + data[i]['work_day'] + '</p>';
                                str += '</div>';
                                str += '</label>';
                            }
                            $('.pre_w_lists').append(str);
                        	 // 锁定
                            me.lock();
                            // 无数据
                            me.noData();
                           // me.resetload();
                            return;
                        },
                        error: function (xhr, type) {
                            //alert('刷新失败');
                            // 即使加载出错，也得重置
                            me.resetload();
                        }
                    });
                }else{
                	me.lock();
                   $.ajax({
                       type: 'post',
                       url: '/Home/Saleman/Saleman/workArgument/op/sendlog',
                       data: {page: 0},
                       dataType: 'json',
                       success: function (result) {
                           me.resetload();
                           return;
                       },
                       error: function (xhr, type) {
                           //alert('刷新失败');
                           // 即使加载出错，也得重置
                           me.resetload();
                           return;
                       }
                   });
                }
            }
        });
        
        //页签点击事件
        $(".weui-navbar__item").on("click", function () {
            var $this = $(this);
            itemIndex = $this.index();
			//选中菜单1，则隐藏明天的工作计划发送
			if (itemIndex == '0')
			{
				$(".next_sel_w").css("display","none")
				$(".cur_sel_w").css("display","block")
			}
			//如果选中的是菜单2，则隐藏今天的工作计划发送
			if (itemIndex == '1')
			{
				$(".next_sel_w").css("display","block")
				$(".cur_sel_w").css("display","none")
			}
			
            // 如果选中菜单3
            if (itemIndex == '2') {
				$(".next_sel_w").css("display","none")
				$(".cur_sel_w").css("display","none")

                // 重置
                $.ajax({
                    type: 'post',
                    url: '/Home/Saleman/Saleman/workArgument/op/sendlog',
                    data: {page: page},
                    dataType: 'json',
                    success: function (result) {
                        page++;
                        var data = result['data'];

                        if (data == null) {
                            return;
                        }

                        var str = '';
                        for (var i = 0; i < data.length; i++) {
                            str += '<a href="/Home/SaleManager/County/workdetail/day/'+data[i]['work_day']+'/userid/<?php echo ($myself["uid"]); ?>"><label class="weui-cell weui-check__label" for="s1211">';
                           
                            str += '<p>' + data[i]['work_day'] +'</p>';
                           
                            str += '</label></a>';
                        }
                        $('.pre_w_lists').append(str);
                    },
                    error: function (xhr, type) {
                    	$('#iosDialog2').find('.sure-info').html('刷新失败');
                        $('#iosDialog2').show(200);
                       // alert('刷新失败');
                    }
                });
            }

        });

        // 明日安排工作添加
        $(".next_btn_w").on("click", function () {
            var content = $(".next_ipt").val();
            if (content.length == 0) {
               // alert("请输入添加的内容");
                $('#iosDialog2').find('.sure-info').html('请输入添加的内容');
                $('#iosDialog2').show(200);
                return;
            }
            $.ajax({
                url: "/Home/Saleman/Saleman/workArgument/op/add",
                type: 'post',
                data: {type: 2, content: content},
                cache: false,
                dataType: "json",
                success: function (result) {
                    if (result['code'] != 1) {
                    	$('#iosDialog2').find('.sure-info').html(result['msg']);
                        $('#iosDialog2').show(200);
                       // alert(result['msg']);
                        return;
                    }
                    var data = result['data'];
                   
                    var str = '';
                    str += '<label class=" weui-cell weui-check__label" for="s1111" attr-id="'+data['flag']+'" id="tomorrow_pop_'+data['flag']+'">';
                    str += '<div class="weui-cell__bd" style = "flex: 2">';
                    str += '<p class = "next_intro sure-info">' + data['content'].substring(0,10) + '....</p>';
                    str+='<input type="hidden" value='+data['content']+'>';
                    str += '</div>';
                    str += '<div class="weui-cell__bd cur_date">';
                    str += '<p>' + data['work_day'] + '</p>';
                    str += '</div>';
                    str += '</label>';

                    if ($('.tomorrow_no_work').length > 0) {
                        $('.tomorrow_no_work').remove();
                    }
                    if ($('.next_w_lists').length <= 0) {
                        var box = '<div class="weui-cells weui-cells_checkbox next_w_lists"></div>';
                        $('.tomorrow_box').append(box);
                    }

                    $(".next_w_lists").append(str);
                    $(".next_ipt").val('');
                }
            });
        });
        $(".accept").click(function () {
            $("#screen").removeClass("weui_mask_visible");
            $("#pop_content").removeClass("weui_dialog_visible");
        });
        //今日安排详细信息查看
        $(document).on("click", "[id^=totay_pop_]", function (e) {
        		$(this).find('.cur_intro').html();
        		$id = $(this).find('.cur_intro').html();
        		 $('.edit_buttons').attr('data-id',$(this).attr('attr-id'));
        		$('.del_confirm_buttons').attr('data-id',$(this).attr('attr-id'));
        		 $('.edit_buttons').attr('data-content',$(this).find('.cur_intro').next().val());
        		 $('#workplay').find('.sure-info').html($(this).find('.cur_intro').next().val());
     	     $('#workplay').show(200);
        });
        //明日计划详细信息查看
        $(document).on("click", "[id^=tomorrow_pop_]", function (e) {
    		$(this).find('.next_intro').html();//清空弹出框内容
    		$('.edit_buttons').attr('data-id',$(this).attr('attr-id'));//将消息id赋值给编辑按钮
    		$('.edit_buttons').attr('data-type','tomorrow');
    		$('.del_confirm_buttons').attr('data-id',$(this).attr('attr-id'));
   		 $('.edit_buttons').attr('data-content',$(this).find('.next_intro').next().val());
    		 $('#workplay').find('.sure-info').html($(this).find('.next_intro').next().val());
 	     $('#workplay').show(200);
    });
        $(".work_buttons").click(function () {
             $('#workplay').hide(200);
             $('#delmessage').hide(200);
             $('#content-editor').hide(200);
             
        });
	    $(".edit_buttons").click(function () {
	    		$id = $(this).attr('data-id');
	    		$('#text-editor').attr('data-id',$id);
	    		s =$(this).attr('data-content');
	    		sb = s.replace('...','');
	    		$('#text-editor').val(sb);
	    		$('#w-txt2').val(sb);
	        $('#workplay').hide(200);
	        $.ajax({
	               url: "/Home/Saleman/Saleman/getWorkDayDatail",
	               type: 'post',
	               data: {id:$id},
	               cache: false,
	               dataType: "json",
	               success: function (result) {
	            	   editimg='';
	            	   if(result.code==200){
	            		   if(result.data[0]['type']==2){
	            			   $('.up-des').css('display','none');
	            			   $('.input_edit').css('display','none');
	            		   }
	            		   if(result.data[0]!=undefined &&result.data[0]['images']!=null){
	            			   images.length = 0;
	            			   if(result.data[0]['images'].indexOf(',')>0){
	            				   reImage = result.data[0]['images'].split(",");
	            				   $(reImage).each(function(index,data){
	   	            			   	   images.push(data);
	            					   editimg+='<img src="'+data+'" width="70" height="70">';
	   	            			   });
	            			   }else{
	            				   images.push(result.data[0]['images']);
	            				   editimg+='<img src="'+result.data[0]['images']+'" width="70" height="70">';
	            			   }
	            			   
	            			  
	            		   }
	            	   }
	            		$("#updata-dialog").css("display","-webkit-box"); 
	            		$('.up-des_edit').empty().append(editimg);
	            	   		/* $("#iosDialog1").hide(200);
	                   $('#iosDialog2').find('.sure-info').html(result['msg']);
	                   $('#iosDialog2').show(200);
	                   $('#delmessage').hide(200); */
	               }
	    	  	 });
	        
	       // $('#content-editor').css('display','block');
	   });
	    
	    $(".confirm_buttons").click(function () {
	    		id = $('#text-editor').attr('data-id');
	    		content = $('#w-txt2').val();
	    		if($('.edit_buttons').attr('data-type')=='tomorrow'){
	    			$.ajax({
	                    url: "/Home/Saleman/Saleman/workArgument/op/add",
	                    type: 'post',
	                    data: {type: 2, content: content,id:id},
	                    cache: false,
	                    dataType: "json",
	                    success: function (result) {
	                        if (result['code'] != 1) {
	                        	 $('#iosDialog2').find('.sure-info').html(result['msg']);
	                             $('#iosDialog2').show(200);
	                            //alert(result['msg']);
	                            return;
	                        }
	                        var data = result['data'];
	                       
	                        var str = '';
	                        str += '<label class=" weui-cell weui-check__label" for="s1111" attr-id="'+data['flag']+'" id="tomorrow_pop_'+data['flag']+'">';
	                        str += '<div class="weui-cell__bd" style = "flex: 2">';
	                        str += '<p class = "next_intro sure-info">' + data['content'].substring(0,10) + '....</p>';
	                        str+='<input type="hidden" value='+data['content']+'>';
	                        str += '</div>';
	                        str += '<div class="weui-cell__bd cur_date">';
	                        str += '<p>' + data['work_day'] + '</p>';
	                        str += '</div>';
	                        str += '</label>';

	                        if ($('.tomorrow_no_work').length > 0) {
	                            $('.tomorrow_no_work').remove();
	                        }
	                        if ($('.next_w_lists').length <= 0) {
	                            var box = '<div class="weui-cells weui-cells_checkbox next_w_lists"></div>';
	                            $('.tomorrow_box').append(box);
	                        }

	                       // $(".next_w_lists").append(str);
	                        $(".next_ipt").val('');
	                        $('#content-editor').hide(200);
		                    window.location.href=location.href;
	                    }
	                });
	    		}else{
	    			$.ajax({
		                url: "/Home/Saleman/Saleman/workArgument/op/add",
		                type: 'post',
		                data: {type: 1, content: content,id:id,images:images},
		                cache: false,
		                dataType: "json",
		                success: function (result) {
		                    if (result['code'] != 1) {
		                    	 $('#iosDialog2').find('.sure-info').html(result['msg']);
	                             $('#iosDialog2').show(200);
		                        //alert(result['msg']);
		                        return;
		                    }
		                    var data = result['data'];
		                   
		                    var str = '';
		                    str += '<label class="weui-cell weui-check__label" for="s11" attr-id="'+data['flag']+'" id="totay_pop_'+data['flag']+'">';
		                    str += '<div class="weui-cell__bd" style = "flex: 2">';
		                    str += '<p class = "cur_intro">' + data['content'].slice(0,10) + '......</p>';
		                    str+='<input type="hidden" value='+data['content']+'>';
		                    str += '</div>';
		                    str += '<div class="weui-cell__bd cur_date">';
		                    str += '<p>' + data['work_day'] + '</p>';
		                    str += '</div>';
		                    str += '</label>';

		                    if ($('.today_no_work').length > 0) {
		                        $('.today_no_work').remove();
		                    }
		                    if ($('.work_lists').length <= 0) {
		                        var box = '<div class="weui-cells weui-cells_checkbox work_lists"></div>';
		                        $('.today_box').append(box);
		                    }

		                    //$(".work_lists").append(str);
		                    $(".cur_ipt").val('');
		                    $('#content-editor').hide(200);
		                    window.location.href=location.href;
		                }
		            });
	    		}
	    		
	    });
        
/* 	    
	    $("[id^=tomorrow_pop_]").mousedown(function() {  
	        timeout = setTimeout(function() {  
	        	$('#delmessage').find('.sure-info').html('确定要删除吗?');
	    	     $('#delmessage').css('display','block');
	        }, 2000);  
	    });  */
	    
	    $(".del_confirm_buttons").click(function () {
	     	$('#delmessage').find('.sure-info').html('确定要删除吗?');
	     	$('#workplay').hide(200);
	     	$('.del_buttons').attr('data-id',$(this).attr('data-id'));
   	     	$('#delmessage').css('display','block');
       });
       $(".del_buttons").click(function () {
    	   id = $(this).attr('data-id');
    	  	 $.ajax({
               url: "/Home/Saleman/Saleman/delTrip",
               type: 'post',
               data: {id:id},
               cache: false,
               dataType: "json",
               success: function (result) {
            	   		$("#iosDialog1").hide(200);
                   $('#iosDialog2').find('.sure-info').html(result['msg']);
                   $('#iosDialog2').show(200);
                   $('#delmessage').hide(200);
               }
    	  	 });
      });
       
       $('.h_back').click(function(){
    	   role_id = $(this).attr('data-role-id');
    	   if(role_id==11){
    		   url = androidBackByRole(role_id,'indexassistant');
    	   }else{
    		   url = androidBackByRole(role_id,'index');
    	   }
    	  
    	   window.location.href=url;
       })
      /*  //加上图片上传
       $('#js_input_file_pic').change(function(){
	    	   $.ajax({
	               url: "/Home/Saleman/Saleman/workUpload",
	               type: 'post',
	               data: {id:id},
	               cache: false,
	               dataType: "json",
	               success: function (result) {
	            	   		$("#iosDialog1").hide(200);
	                   $('#iosDialog2').find('.sure-info').html(result['msg']);
	                   $('#iosDialog2').show(200);
	                   $('#delmessage').hide(200);
	               }
	    	  	 });
       }) */
       //实现图片本地预览
        function preview(input) {
            if (input.files && input.files[0]) {
                var reader = new FileReader();
                reader.onload = function (e) {
	                	img ='<img src="'+e.target.result+'" width="70" height="70">';
	                	if(input.className.indexOf('edit')>0){
	                		$('.up-des_edit').append(img);
	                	}else{
	                		$('.up-des').append(img);
                		}
                	
                };
                reader.readAsDataURL(input.files[0]);
                ajaxUpload(input);
            }
        }
        //处理照片上传
        function ajaxUpload(input){
        	var formdata = new FormData(); 
        	formdata.append(input.name, input.files[0]); 
        	$('#loadingToast').css({'opacity':'1','display':'block'});
        	$('.cur_btn_w').attr('disabled',"true");
        	$.ajax({ 
        		url : '/Home/Saleman/Saleman/workUpload/f/json', 
        		type : 'post', 
        		data : formdata, 
        		cache : false, 
        		contentType : false, 
        		processData : false, 
        		dataType : "json", 
        		success : function(data) { 
        			$('.cur_btn_w').attr('disabled',"false");
        			if(data.code=200){
        				images.push(data.data.uploadFile);
        			}else{
        				$('.weui-dialog__bd').html(data.msg);
        	     		$('#confirm_dialog').css('display','block');
        			} 			
        			$('#loadingToast').css({'opacity':'1','display':'none'});		
        		},error:function(returndata){
        			$('#loadingToast').css({'opacity':'1','display':'none'});	
        			 	$("#iosDialog1").hide(200);
                     $('#iosDialog2').find('.sure-info').html('图片格式不正确或者网络繁忙');
                     $('#iosDialog2').show(200);
        		} 
        	}); 
        }
        
     // 初始化Web Uploader
/*         $(document).ready(function () { */
            var $list = $("#fileList");
            uploaderImg = WebUploader.create({

                // 选完文件后，是否自动上传。
                auto: true,
                // swf文件路径
                 swf: "../img/upload/Uploader.swf",

                // 文件接收服务端。
                server: window.location.protocol + '//' + window.location.host +'/Home/Saleman/Saleman/webup',
                // 选择文件的按钮。可选。
                // 内部根据当前运行是创建，可能是input元素，也可能是flash.
                pick: '#filePicker',

                // 只允许选择图片文件。
                accept: {
                    title: 'Images',
                    extensions: 'gif,jpg,jpeg,bmp,png',
                    mimeTypes: 'image/*'
                }
            });

            // 当有文件添加进来的时候
            uploaderImg.on( 'fileQueued', function( file ) {
                var $li = $(
                        '<div id="' + file.id + '"class="file-item thumbnail col-md-3">' +
                        '<img>' +
                        '<div class="info">' + file.name + '</div>' +
                        '<div class="error"></div>'+
                        '</div>'
                    ),
                    $img = $li.find('img');

                // $list为容器jQuery实例
                $list.append( $li );

                // 创建缩略图
                // 如果为非图片文件，可以不用调用此方法。
                // thumbnailWidth x thumbnailHeight 为 100 x 100
                uploaderImg.makeThumb( file, function( error, src ) {
                    if ( error ) {
                        $img.replaceWith('<span>不能预览</span>');
                        return;
                    }
                    $img.attr( 'src', src );
                }, 210, 110 );
            });

            // 文件上传过程中创建进度条实时显示。
            uploaderImg.on( 'uploadProgress', function( file, percentage ) {
                var $li = $( '#'+file.id ),
                    $percent = $li.find('.progress span');

                // 避免重复创建
                if ( !$percent.length ) {
                    $percent = $('<p class="progress"><span></span></p>')
                        .appendTo( $li )
                        .find('span');
                }

                $percent.css( 'width', percentage * 100 + '%' );
             	$('#loadingToast').css({'opacity':'1','display':'block'});
            });

        // 文件上传成功，给item添加成功class, 用样式标记上传成功。
            uploaderImg.on( 'uploadSuccess', function( file,response ) {
            		str = response.id;
            		images.push(str.replace('./',"/"));
                $( '#'+file.id ).addClass('upload-state-done');
             	$('#loadingToast').css({'opacity':'1','display':'none'});
            });

        // 文件上传失败，显示上传出错。
            uploaderImg.on( 'uploadError', function( file ) {
                var $li = $( '#'+file.id ),
                    $error = $li.find('div.error');

                // 避免重复创建
                if ( !$error.length ) {
                    $error = $('<div class="error"></div>').appendTo( $li );
                }

                $error.text('上传失败');
            });

        // 完成上传完了，成功或者失败，先删除进度条。
            uploaderImg.on( 'uploadComplete', function( file ) {
                $( '#'+file.id ).find('.progress').remove();
            });

      /*   }); */

    </script>
</body>
</html>